package 寒假刷题;

public class 各位相加 {
    public int addDigits(int num) {
        while (num>=10){
            int ans = 0;
            while (num>0){
                int a = num % 10;
                num/=10;
                ans+=a;
            }
            num = ans;
        }
        return num;
    }
}
